﻿<%@ Page Title="Profile Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Profile.aspx.cs" Inherits="JustTest.Profile" %>

<asp:Content ID="ProfilePageContent" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <asp:FormView ID="FormViewProfile" runat="server"
            SelectMethod="FormViewProfile_GetItem"
            ItemType="JustTest.Models.ApplicationUser">
            <ItemTemplate>
                
                <div >
                    <table class="table table-condensed">
                        <th class="label-info">
                            
                        </th>
                        <th class="label-info">
                            <%#:Item.UserName+"'s Profile" %>               
                        </th>
                        <tr>
                            <td>Profile picture</td>
                            <td> <asp:Image ImageUrl='<%#: "profilePic.img?userId=" + Item.Id  %>' Width="150" BorderWidth="1" class="img-polaroid" runat="server" /></td>
                        </tr>
                         <tr>
                            <td>First name: </td>
                            <td><%#: Item.FirstName %></td>
                        </tr>
                        <tr>
                            <td>Last name: </td>
                            <td><%#: Item.LastName %></td>
                        </tr>
                    </table>
                </div>
            
            </ItemTemplate>
        </asp:FormView>
        <br />

        <h2 class="label-info">Your tests</h2>
        <br />
        <asp:GridView ID="GridViewTests" runat="server" 
           CssClass="table table-hover table-striped"
            ItemType="JustTest.Models.Test"
            AutoGenerateColumns="false"
            SelectMethod="GridViewTests_GetData"
            AllowSorting="true" 
            OnPageIndexChanging="GridViewTests_PageIndexChanging"
            AllowPaging="true"
            PageSize="10">
            <Columns>
                <asp:DynamicField DataField="Title" HeaderText="Title"/>
                <asp:DynamicField DataField="ReleaseDate" HeaderText="ReleaseDate"/>
                <asp:HyperLinkField DataNavigateUrlFormatString="~/User/Test?id={0}" DataNavigateUrlFields="Id"  ControlStyle-CssClass="btn btn-success" Text="Solve" />
                <asp:HyperLinkField DataNavigateUrlFormatString="~/Author/AuthorEditTest?id={0}" DataNavigateUrlFields="Id"  ControlStyle-CssClass="btn btn-info" Text="Edit" />
            </Columns>
            <EmptyDataTemplate>
                You haven't created any tests.
            </EmptyDataTemplate>
        </asp:GridView>

        <h2 class="label-info">Your scores</h2>
        <br />
        <asp:GridView ID="GridViewScores" runat="server" 
             CssClass="table table-hover table-striped"
            ItemType="JustTest.Models.TestResult"
            AutoGenerateColumns="false"
            SelectMethod="GridViewScores_GetData"
            AllowSorting="true"
            OnPageIndexChanging="GridViewScores_PageIndexChanging"
            AllowPaging="true" 
            PageSize="10">
            <Columns>
                <asp:DynamicField DataField="TestTitle" HeaderText="Test Title"/>
                <asp:DynamicField DataField="Result" HeaderText="Result"/>
                <asp:DynamicField DataField="MaxResult" HeaderText="Max Result"/>
                <asp:DynamicField DataField="PassDate" HeaderText="Pass Date"/>
            </Columns>
            <EmptyDataTemplate>
                <div>You haven't solve any tests.</div>
            </EmptyDataTemplate>
        </asp:GridView>
    </div>
</asp:Content>
